< previous page page_658 next page >

Page 658
generated by the dialog box. Figure 29.15 shows how the selection criteria have been changed to include only authors born during or after 1950.
0658-01.jpg
Figure 29.15
Using the Formula Editor window, you can build
expressions involving fields, functions, and operators.
Note that changing the selection criteria within a report to limit records is far less efficient than changing the source recordset. If you modify the selection criteria, the report's underlying recordset still contains as many records as it did originally; the selection filter(s) only limits how many records are presented to the user in the report. In the example, the report would still contain all authors, even though it displays only the ones born since 1950.
Using the Crystal Reports Control
Once you complete the design of your report, you should have an RPT file saved on your hard drive. You can use this file in conjunction with the Crystal Reports control to display your report from within a Visual Basic application.
note.gif If you use a Crystal Report in your application, you have to distribute the report file plus all the support files required to run the report on another user's machine. square.gif

Because the Crystal Reports control is a third-party control, it is not available in Visual Basic's Toolbox by default. To add the control to your Toolbox, choose Project, Components or press Ctrl+T. Then select the Crystal Reports Control check box and click OK.
crcontrol.gif To demonstrate how the control works, use it to display the sample report created in the preceding section. First, start a new Standard EXE project, and add the Crystal Reports control to your Toolbox. Draw an instance of the Crystal Reports control on the form. Notice that it appears icon-sized, as pictured in Figure 29.16.
Specifying the Report File
The key property that you need to specify is the ReportFileName property, which is the path to the RPT file you created in the Report Designer. If you plan to use the Crystal Reports control to display multiple reports, you probably should set this property at runtime, as in the following example:
CrystalReport1.ReportFileName = App.Path & "\Test.Rpt"

 
< previous page page_658 next page >